package com.example.userservice.novel.service;

import com.example.userservice.novel.entity.NovelStructure;
import com.example.userservice.novel.entity.SimpleCharacter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NovelExample {

    @Autowired
    private SimpleNovelService simpleNovelService;

    /**
     * 示例： 生成小说架构
     */
    public void generateExample() {
        String novelName = "地球核变";

        //方法1：一次性生成
        NovelStructure structure = simpleNovelService.generateNovelStructure(novelName);
        printNovelStructure( structure);

        //方法2：分步骤生成
        structure = simpleNovelService.generateStepByStep(novelName);
        printNovelStructure( structure);
    }

    public void printNovelStructure(NovelStructure structure) {
        System.out.println("小说名称：" + structure.getNovelName());
        System.out.println("主题：" + structure.getTheme());
        System.out.println("主要角色：");
        for (SimpleCharacter character : structure.getMainCharacters()) {
            System.out.println("- " + character.getName() + "(" + character.getIdentity() + ")");
        }
        System.out.println("故事大纲：" + structure.getPlotOutline());
        System.out.println("世界观：" + structure.getWorldSetting());
        System.out.println("写作风格：" + structure.getWritingStyle());
        System.out.println("生成时间：" + structure.getGeneratedAt());
    }
}
